package com.example.demo;

import com.example.demo.refelt.User;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class TestRe {
  public static void main(String[] args)
          throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, ClassNotFoundException, InstantiationException {
	  Class<User> clazz = User.class;
	  User user = (User) Class.forName("com.example.demo.refelt.User").newInstance();
	  Method[] methods = clazz.getDeclaredMethods();
	  for (Method m : methods) {
	      if (m.getName().equals("add")){
	          m.invoke(user,  5);
          }
      }
  }
}
